<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='wlgl'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-form-item">
                <form name="totalForm" id="totalForm">
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='zt'/></label>
                        <div class="layui-input-inline">
                            <select name="status">
                                <option value="0" <c:if test="${params.status == 0}">selected</c:if>><fmt:message key='qxz'/></option>
                                <option value="1" <c:if test="${params.status == 1}">selected</c:if>><fmt:message key='wjh'/></option>
                                <option value="2" <c:if test="${params.status == 2}">selected</c:if>><fmt:message key='yjh'/></option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="layui-card">
        <div class="layui-field-box layui-form">
            <%--<shiro:hasPermission name="express:create">--%>
                <a href="javascript:void(0);" class="layui-btn layui-btn-sm layui-btn-normal" id="add"><i class="layui-icon">&#xe61f;</i> <fmt:message key='xjhyk'/></a>
                <a href="${web_domain}/mall/memberCard/exports?status=${params.status}" class="layui-btn layui-btn-sm" id="export"><i class="layui-icon">&#xe601;</i> <fmt:message key='dchyk'/></a>
            <%--</shiro:hasPermission>--%>

            <table class="layui-table" lay-size="sm">
                <thead>
                <tr>
                    <th width="5%"><input id="checkboxs" type="checkbox" value="${item.id}" lay-ignore lay-skin="primary"/></th>
                    <th width="25%"><fmt:message key='kh'/></th>
                    <th width="25%"><fmt:message key='bdhy'/></th>
                    <th width="20%"><fmt:message key='zt'/></th>
                    <th width="20%"><fmt:message key='cjsj'/></th>
                    <th width="20%"><fmt:message key='jhsj'/></th>
                    <th><fmt:message key='cz'/></th>
                </tr>
                </thead>
                <c:forEach items="${page.result}" var="item" varStatus="status">
                    <tr>
                        <td><input type="checkbox" lay-ignore value="${item.id}" class="feijin-check" lay-skin="primary"/></td>
                        <td>${item.no}</td>
                        <td>${item.member.username}</td>
                        <td>
                            <c:if test="${item.status == 1}"><b style="color: #f00;"><fmt:message key='wjh'/></b></c:if>
                            <c:if test="${item.status == 2}"><b style="color: green;"><fmt:message key='yjh'/></b></c:if>
                        </td>
                        <td><fmt:formatDate value="${item.createTime}" type="both"/></td>
                        <td><fmt:formatDate value="${item.activateTime}" type="both"/></td>
                        <td>
                            <div class="layui-btn-container">
                                <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-danger layui-btn-xs feijin-remove"><fmt:message key='sc'/></a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <jsp:include page="/commons/page.jsp" flush="true"/>
        </div>
    </div>

</div>

<script>

    layui.use("layer", function () {

        //添加会员卡
        $("#add").click(function () {

            var count = "";

            layer.prompt({
                title: "<fmt:message key='qsrxycjdhyksl'/>",
                value: count
            }, function (value, index, elem) {

                feijin.post({
                    url: "${web_domain}/mall/memberCard/create",
                    data: {"count": value}
                });
            });
        });

    });
</script>
</body>
</fmt:bundle>
</html>
